classDiagram
    class Component {
        <<interface>>
        +operation(): string
        +add(component: Component): void
        +remove(component: Component): void
        +getChild(index: int): Component
    }
    class Leaf {
        +operation(): string
    }
    class Composite {
        -children: Component[]
        +operation(): string
        +add(component: Component): void
        +remove(component: Component): void
        +getChild(index: int): Component
    }

    Component <|.. Leaf
    Component <|.. Composite
    Composite o-- Component : contains
